<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form class="layui-form" action="save" method="post" style="padding-top:20px;padding-right: 100px;" lay-filter="stuform">
		<input type="hidden" name="id" value="${model.id}">
		<input type="hidden" name="parentId" value="${model.parent.id}">
		<c:if test="${model.parentId=='0'}">
			<div class="layui-form-item">
	    		<label class="layui-form-label">名称</label>
	    		<div class="layui-input-block">
	      			<input type="text" name="name" value="${model.name}" lay-verify="required" required autocomplete="off" placeholder="请输入名称" class="layui-input">
	    		</div>
	  		</div>
			<div class="layui-form-item">
	    		<label class="layui-form-label">代码</label>
	    		<div class="layui-input-block">
	      			<input type="text" name="code" value="${model.code}" required autocomplete="off" placeholder="请输入代码" class="layui-input">
	    		</div>
	  		</div>
		</c:if>
		<c:if test="${model.parentId!='0' }">
			<div class="layui-form-item">
	    		<label class="layui-form-label">权限</label>
	    		<div class="layui-input-block">
					<select name="permissionCode" lay-search>
						<option value="" style="display: none;"></option>
						<c:forEach items="${roles}" var="role">
							<option value="${role.code}" ${model.code==role.code?'selected':''}>${role.name}</option>
						</c:forEach>
					</select>
	    		</div>
	  		</div>
			
		</c:if>
		<div class="layui-form-item">
    		<label class="layui-form-label">排序</label>
    		<div class="layui-input-block">
      			<input type="text" name="idx1" value="${model.idx1}" required autocomplete="off" placeholder="请输入序号" class="layui-input">
    		</div>
  		</div>
	</form>
	<script type="text/javascript">
		form=layui.form;
		form.render('select');
	</script>
</body>
</html>